<!DOCTYPE html>


  <html class="dark page-post">


<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="utf-8">
  
  <title>初探RESTful API | Poetry&#39;s Blog</title>

  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

  
    <meta name="keywords" content="JavaScript,RESTful API,">
  

  <meta name="description" content="一、RESTful API 简介 总结一下什么是RESTful架构  每一个URI代表一种资源 客户端和服务器之间，传递这种资源的某种表现层 客户端通过四个HTTP动词(GET、POST、PUT、DELETE)，对服务器端资源进行操作，实现”表现层状态转化”  二、RESTful API 设计2.1、协议 API与用户的通信协议，总是使用HTTPs协议  2.2、域名 应该尽量将API部署在专用域">
<meta name="keywords" content="JavaScript,RESTful API">
<meta property="og:type" content="article">
<meta property="og:title" content="初探RESTful API">
<meta property="og:url" content="http://blog.poetries.top/2017/10/23/restful-api/index.html">
<meta property="og:site_name" content="Poetry&#39;s Blog">
<meta property="og:description" content="一、RESTful API 简介 总结一下什么是RESTful架构  每一个URI代表一种资源 客户端和服务器之间，传递这种资源的某种表现层 客户端通过四个HTTP动词(GET、POST、PUT、DELETE)，对服务器端资源进行操作，实现”表现层状态转化”  二、RESTful API 设计2.1、协议 API与用户的通信协议，总是使用HTTPs协议  2.2、域名 应该尽量将API部署在专用域">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://poetries1.gitee.io/img-repo/2019/10/509.png">
<meta property="og:image" content="https://poetries1.gitee.io/img-repo/2019/10/510.png">
<meta property="og:image" content="https://poetries1.gitee.io/img-repo/2019/10/511.png">
<meta property="og:updated_time" content="2020-08-15T04:25:31.934Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="初探RESTful API">
<meta name="twitter:description" content="一、RESTful API 简介 总结一下什么是RESTful架构  每一个URI代表一种资源 客户端和服务器之间，传递这种资源的某种表现层 客户端通过四个HTTP动词(GET、POST、PUT、DELETE)，对服务器端资源进行操作，实现”表现层状态转化”  二、RESTful API 设计2.1、协议 API与用户的通信协议，总是使用HTTPs协议  2.2、域名 应该尽量将API部署在专用域">
<meta name="twitter:image" content="https://poetries1.gitee.io/img-repo/2019/10/509.png">

  

  
    <link rel="icon" href="/favicon.ico">
  

  <link href="/css/styles.css?v=c114cbeddx" rel="stylesheet">
<link href="/css/other.css?v=c114cbeddx" rel="stylesheet">


  
    <link rel="stylesheet" href="/css/personal-style.css">
  

  

  
  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?40b1f89aa80f2527b3db779c6898c879";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>


  
  <script type="text/javascript">
	(function(){
	    var bp = document.createElement('script');
	    var curProtocol = window.location.protocol.split(':')[0];
	    if (curProtocol === 'https') {
	        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
	    }
	    else {
	        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
	    }
	    var s = document.getElementsByTagName("script")[0];
	    s.parentNode.insertBefore(bp, s);
	})();
  </script>



  
    <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.3.0/css/font-awesome.min.css">
  

  <!-- 聊天系统 -->
  
    
   <link type="text/css" rel="stylesheet" href="/renxi/default.css">
   <style>
      #modal {
        position: static !important;
      }
      .filter {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        background: #fe5757;
        animation: colorChange 30s ease-in-out infinite;
        animation-fill-mode: both;
        mix-blend-mode: overlay;
      }
  
      @keyframes colorChange {
        0%, 100% {
            opacity: 0;
        }
        50% {
            opacity: .9;
        }
      }
   </style>
</head>
</html>
<body>
  
  
    <span id="toolbox-mobile" class="toolbox-mobile">导航</span>
  

  <div class="post-header CENTER">
   
  <div class="toolbox">
    <a class="toolbox-entry" href="/">
      <span class="toolbox-entry-text">导航</span>
      <i class="icon-angle-down"></i>
      <i class="icon-home"></i>
    </a>
    <ul class="list-toolbox">
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/archives/"
            rel="noopener noreferrer"
            target="_self"
            >
            博客
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/categories/"
            rel="noopener noreferrer"
            target="_self"
            >
            分类
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/tags/"
            rel="noopener noreferrer"
            target="_self"
            >
            标签
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/search/"
            rel="noopener noreferrer"
            target="_self"
            >
            搜索
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/link/"
            rel="noopener noreferrer"
            target="_self"
            >
            友链
          </a>
        </li>
      
        <li class="item-toolbox">
          <a
            class="CIRCLE"
            href="/about/"
            rel="noopener noreferrer"
            target="_self"
            >
            关于
          </a>
        </li>
      
    </ul>
  </div>


</div>


  <div id="toc" class="toc-article">
    <strong class="toc-title">文章目录<i class="iconfont toc-title" style="display:inline-block;color:#87998d;width:20px;height:20px;">&#xf004b;</i></strong>
    <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#一、RESTful-API-简介"><span class="toc-text">一、RESTful API 简介</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#二、RESTful-API-设计"><span class="toc-text">二、RESTful API 设计</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1、协议"><span class="toc-text">2.1、协议</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2、域名"><span class="toc-text">2.2、域名</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3、版本（Versioning）"><span class="toc-text">2.3、版本（Versioning）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-4、路径（Endpoint）"><span class="toc-text">2.4、路径（Endpoint）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-5、HTTP动词"><span class="toc-text">2.5、HTTP动词</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-6、过滤信息"><span class="toc-text">2.6、过滤信息</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-7、状态码"><span class="toc-text">2.7、状态码</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-8、错误处理"><span class="toc-text">2.8、错误处理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-9、返回结果"><span class="toc-text">2.9、返回结果</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-10、Hypermedia-API"><span class="toc-text">2.10、Hypermedia API</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#三、参考资料"><span class="toc-text">三、参考资料</span></a></li></ol>
  </div>
  




<div class="content content-post CENTER">
   <!-- canvas 彩带 -->
<canvas id="evanyou" width="1302" height="678" style="position: fixed;width: 100%;height: 100%;top: 0;left:0;z-index:-1;"></canvas>

<article id="post-restful-api" class="article article-type-post" itemprop="blogPost">
  <header class="article-header" style="position:relative;">
    <h1 class="post-title">初探RESTful API</h1>

    <div class="article-meta">
      <span>
        <i class="icon-calendar"></i>
        <span>2017.10.23</span>
      </span>

      
        <span class="article-author">
          <i class="icon-user"></i>
          <span>Poetry</span>
        </span>
      

      
  <span class="article-category">
    <i class="icon-list"></i>
    <a class="article-category-link" href="/categories/Front-End/">Front-End</a>
  </span>



      

      
      <i class="fa fa-eye"></i> 
        <span id="busuanzi_container_page_pv">
           &nbsp热度 <span id="busuanzi_value_page_pv">
           <i class="fa fa-spinner fa-spin"></i></span>℃
        </span>
      
      
       
          <span class="post-count">
            <i class="fa fa-file-word-o"></i>&nbsp
            <span>字数统计 1.1k字</span>
          </span>

          <span class="post-count">
            <i class="fa fa-columns"></i>&nbsp
            <span>阅读时长 4分</span>
          </span>
      
      
    </div>

    <i class="iconfont" id="toc-eye" style="display:inline-block;color:#b36619;position:absolute;top:0;right:0;cursor:pointer;
    font-size: 24px;">&#xe61c;</i>

  </header>

  <div class="article-content">
    
      <div id="container">
        <h2 id="一、RESTful-API-简介"><a href="#一、RESTful-API-简介" class="headerlink" title="一、RESTful API 简介"></a>一、RESTful API 简介</h2><p><img src="https://poetries1.gitee.io/img-repo/2019/10/509.png" alt><br><img src="https://poetries1.gitee.io/img-repo/2019/10/510.png" alt><br><img src="https://poetries1.gitee.io/img-repo/2019/10/511.png" alt></p>
<p><strong>总结一下什么是RESTful架构</strong></p>
<ul>
<li>每一个<code>URI</code>代表一种资源</li>
<li>客户端和服务器之间，传递这种资源的某种表现层</li>
<li>客户端通过四个<code>HTTP</code>动词(<code>GET、POST、PUT、DELETE</code>)，对服务器端资源进行操作，实现”表现层状态转化”</li>
</ul>
<h2 id="二、RESTful-API-设计"><a href="#二、RESTful-API-设计" class="headerlink" title="二、RESTful API 设计"></a>二、RESTful API 设计</h2><h3 id="2-1、协议"><a href="#2-1、协议" class="headerlink" title="2.1、协议"></a>2.1、协议</h3><ul>
<li><code>API</code>与用户的通信协议，总是使用<code>HTTPs</code>协议</li>
</ul>
<h3 id="2-2、域名"><a href="#2-2、域名" class="headerlink" title="2.2、域名"></a>2.2、域名</h3><ul>
<li>应该尽量将<code>API</code>部署在专用域名之下</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">https:<span class="comment">//api.example.com</span></span><br></pre></td></tr></table></figure>
<ul>
<li>如果确定API很简单，不会有进一步扩展，可以考虑放在主域名下</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">https:<span class="comment">//example.org/api/</span></span><br></pre></td></tr></table></figure>
<h3 id="2-3、版本（Versioning）"><a href="#2-3、版本（Versioning）" class="headerlink" title="2.3、版本（Versioning）"></a>2.3、版本（Versioning）</h3><ul>
<li>应该将<code>API</code>的版本号放入<code>URL</code></li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">https:<span class="comment">//api.example.com/v1/</span></span><br></pre></td></tr></table></figure>
<h3 id="2-4、路径（Endpoint）"><a href="#2-4、路径（Endpoint）" class="headerlink" title="2.4、路径（Endpoint）"></a>2.4、路径（Endpoint）</h3><ul>
<li>表示<code>API</code>的具体网址</li>
<li><p>在<code>RESTful</code>架构中，每个网址代表一种资源（<code>resource</code>），所以网址中不能有动词，只能有名词</p>
</li>
<li><p>举例来说，有一个<code>API</code>提供动物园（<code>zoo</code>）的信息，还包括各种动物和雇员的信息，则它的路径应该设计成下面这样</p>
</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">https:<span class="comment">//api.example.com/v1/zoos</span></span><br><span class="line">https:<span class="comment">//api.example.com/v1/animals</span></span><br><span class="line">https:<span class="comment">//api.example.com/v1/employees</span></span><br></pre></td></tr></table></figure>
<h3 id="2-5、HTTP动词"><a href="#2-5、HTTP动词" class="headerlink" title="2.5、HTTP动词"></a>2.5、HTTP动词</h3><ul>
<li>对于资源的具体操作类型，由<code>HTTP</code>动词表示</li>
</ul>
<ul>
<li><code>GET（SELECT）</code>：从服务器取出资源（一项或多项）。</li>
<li><code>POST（CREATE）</code>：在服务器新建一个资源。</li>
<li><code>PUT（UPDATE）</code>：在服务器更新资源（客户端提供改变后的完整资源）。</li>
<li><code>PATCH（UPDATE）</code>：在服务器更新资源（客户端提供改变的属性）。</li>
<li><code>DELETE（DELETE）</code>：从服务器删除资源。</li>
</ul>
<blockquote>
<p>下面是一些例子</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">GET /zoos：列出所有动物园</span><br><span class="line">POST /zoos：新建一个动物园</span><br><span class="line">GET /zoos/ID：获取某个指定动物园的信息</span><br><span class="line">PUT /zoos/ID：更新某个指定动物园的信息（提供该动物园的全部信息）</span><br><span class="line">PATCH /zoos/ID：更新某个指定动物园的信息（提供该动物园的部分信息）</span><br><span class="line">DELETE /zoos/ID：删除某个动物园</span><br><span class="line">GET /zoos/ID/animals：列出某个指定动物园的所有动物</span><br><span class="line">DELETE /zoos/ID/animals/ID：删除某个指定动物园的指定动物</span><br></pre></td></tr></table></figure>
<h3 id="2-6、过滤信息"><a href="#2-6、过滤信息" class="headerlink" title="2.6、过滤信息"></a>2.6、过滤信息</h3><blockquote>
<p>如果记录数量很多，服务器不可能都将它们返回给用户。API应该提供参数，过滤返回结果</p>
</blockquote>
<ul>
<li>下面是一些常见的参数<ul>
<li><code>?limit=10</code>：指定返回记录的数量</li>
<li><code>?offset=10</code>：指定返回记录的开始位置。</li>
<li><code>?page=2&amp;per_page=100</code>：指定第几页，以及每页的记录数。</li>
<li><code>?sortby=name&amp;order=asc</code>：指定返回结果按照哪个属性排序，以及排序顺序。</li>
<li><code>?animal_type_id=1</code>：指定筛选条件</li>
</ul>
</li>
</ul>
<blockquote>
<p>参数的设计允许存在冗余，即允许API路径和URL参数偶尔有重复。比如，<code>GET /zoo/ID/animals</code> 与 <code>GET /animals?zoo_id=ID</code> 的含义是相同的</p>
</blockquote>
<h3 id="2-7、状态码"><a href="#2-7、状态码" class="headerlink" title="2.7、状态码"></a>2.7、状态码</h3><blockquote>
<p>服务器向用户返回的状态码和提示信息</p>
</blockquote>
<h3 id="2-8、错误处理"><a href="#2-8、错误处理" class="headerlink" title="2.8、错误处理"></a>2.8、错误处理</h3><blockquote>
<p>如果状态码是<code>4xx</code>，就应该向用户返回出错信息。一般来说，返回的信息中将<code>error</code>作为键名，出错信息作为键值即可</p>
</blockquote>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">&#123;</span><br><span class="line">    error: <span class="string">"Invalid API key"</span></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h3 id="2-9、返回结果"><a href="#2-9、返回结果" class="headerlink" title="2.9、返回结果"></a>2.9、返回结果</h3><ul>
<li>针对不同操作，服务器向用户返回的结果应该符合以下规范</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">GET /collection：返回资源对象的列表（数组）</span><br><span class="line">GET /collection/resource：返回单个资源对象</span><br><span class="line">POST /collection：返回新生成的资源对象</span><br><span class="line">PUT /collection/resource：返回完整的资源对象</span><br><span class="line">PATCH /collection/resource：返回完整的资源对象</span><br><span class="line">DELETE /collection/resource：返回一个空文档</span><br></pre></td></tr></table></figure>
<h3 id="2-10、Hypermedia-API"><a href="#2-10、Hypermedia-API" class="headerlink" title="2.10、Hypermedia API"></a>2.10、Hypermedia API</h3><blockquote>
<p><code>RESTful API</code>最好做到<code>Hypermedia</code>，即返回结果中提供链接，连向其他<code>API</code>方法，使得用户不查文档，也知道下一步应该做什么</p>
</blockquote>
<ul>
<li>比如，当用户向<code>api.example.com</code>的根目录发出请求，会得到这样一个文档</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="code"><pre><span class="line">&#123;<span class="string">"link"</span>: &#123;</span><br><span class="line">  <span class="string">"rel"</span>:   <span class="string">"collection https://www.example.com/zoos"</span>,</span><br><span class="line">  <span class="string">"href"</span>:  <span class="string">"https://api.example.com/zoos"</span>,</span><br><span class="line">  <span class="string">"title"</span>: <span class="string">"List of zoos"</span>,</span><br><span class="line">  <span class="string">"type"</span>:  <span class="string">"application/vnd.yourformat+json"</span></span><br><span class="line">&#125;&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>上面代码表示，文档中有一个<code>link</code>属性，用户读取这个属性就知道下一步该调用什么<code>API</code>了。<code>rel</code>表示这个<code>API</code>与当前网址的关系（collection关系，并给出该collection的网址），<code>href</code>表示<code>API</code>的路径，<code>title</code>表示<code>API</code>的标题，<code>type</code>表示返回类型</li>
</ul>
<h2 id="三、参考资料"><a href="#三、参考资料" class="headerlink" title="三、参考资料"></a>三、参考资料</h2><ul>
<li><a href="http://www.ruanyifeng.com/blog/2014/05/restful_api.html" target="_blank" rel="noopener">restful_api</a></li>
</ul>

      </div>
    
  </div>

</article>

<button class="assist-btn2 circle" id="assist_btn2" title="点亮屏幕" style="left: 27px; top: 152px;">
  <i class="iconfont" style="display:inline-block;color:red;width:20px;height:20px;">&#xe61d;</i>
</button>
<button class="assist-btn1 circle" id="assist_btn1" title="关闭屏幕亮度" style="left: 27px; top: 152px;">
  <i class="iconfont toc-title" style="display:inline-block;color:red;width:20px;height:20px;">&#xe61d;</i>
</button>


<script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>	

<script src="https://my.openwrite.cn/js/readmore.js" type="text/javascript"></script>
<script>
  const btw = new BTWPlugin();
  btw.init({
    id: "container",
    blogId: "22699-1592137983091-414",
    name: "前端进阶之旅",
    qrcode: "https://poetries1.gitee.io/img-repo/2020/06/qrcode.jpg",
    keyword: "3a3b3c",
  });
</script>

<script type="text/javascript">

// white theme
var body = {color: "#555", background: "#000"};
var a_tag = {color: "#222"};
var header = { background: "#222"};
var logo_line_i = {background: "#222"};
// var post_code = {background: "#eee", color: "#222"};

function switch_theme() {
 $("body").css(body);
 $("a:not('.links-of-author-item a, .site-state-item a, .site-state-posts a, .feed-link a, .motion-element a, .post-tags a, .show-commit-cls a, #donate_board a')").css(a_tag);
 $(".header, .footer").css(header);
 $(".logo-line-before i, .logo-line-after i").css(logo_line_i);
 //$(".post code").css(post_code);
 $("#idhyt-surprise-ball #idhyt-surprise-ball-animation .drag").css(a_tag);
 $(".post-title-link, .posts-expand .post-meta, .post-comments-count, .disqus-comment-count, .post-category a, .post-nav-next a, .post-nav-item a").css(a_tag);
 
 // $("code").css({color: '#c5c8c6', background: '#1d1f21'});
 //$("#assist_btn1").hide(1500);
}

$(function () {
$("#assist_btn2").css("display","none");
 $("#assist_btn1").click(function() {
     switch_theme();
$("div#toc.toc-article").css({
 "background":"#eaeaea",
 "opacity":1
});
$(".toc-article ol").show();
$("#toc.toc-article .toc-title").css("color","#a98602");
$("#assist_btn1").css("display","none");
$("#assist_btn2").css("display","block");
 });
$("#assist_btn2").click(function() {
$("#assist_btn2").css("display","none");
$("#assist_btn1").css("display","block");
$("body").css("background","url(http://www.miaov.com/static/ie/images/news/bg.png)")
     $(".header, .footer").css("background","url(http://www.miaov.com/static/ie/images/news/bg.png)")
$(".toc-article ol").toggle(1000);
 });
});


//背景随机

var Y, O, E, L, B, C, T, z, N, S, A, I;
!function() {
var e = function() {
for (O.clearRect(0, 0, L, B), T = [{
x: 0,
y: .7 * B + C
}, {
x: 0,
y: .7 * B - C
}]; T[1].x < L + C;) t(T[0], T[1])
}, t = function(e, t) {
O.beginPath(), O.moveTo(e.x, e.y), O.lineTo(t.x, t.y);
var n = t.x + (2 * I() - .25) * C,
 r = a(t.y);
O.lineTo(n, r), O.closePath(), N -= S / -50, O.fillStyle = "#" + (127 * A(N) + 128 << 16 | 127 * A(N + S / 3) + 128 << 8 | 127 * A(N + S / 3 * 2) + 128).toString(16), O.fill(), T[0] = T[1], T[1] = {
 x: n,
 y: r
}
}, a = function n(e) {
var t = e + (2 * I() - 1.1) * C;
return t > B || t < 0 ? n(e) : t
};
Y = document.getElementById("evanyou"), O = Y.getContext("2d"), E = window.devicePixelRatio || 1, L = window.innerWidth, B = window.innerHeight, C = 90, z = Math, N = 0, S = 2 * z.PI, A = z.cos, I = z.random, Y.width = L * E, Y.height = B * E, O.scale(E, E), O.globalAlpha = .6, document.onclick = e, document.ontouchstart = e, e()
}()

   
$("#toc-eye").click(function(){
$("#toc.toc-article").toggle(1000);
});

</script>


   
  <div class="text-center donation">
    <div class="inner-donation">
      <span class="btn-donation">支持一下</span>
      <div class="donation-body">
        <div class="tip text-center">扫一扫，支持poetries</div>
        <ul>
        
          <li class="item">
            
              <span>微信扫一扫</span>
            
            <img src="/images/weixin.jpg" alt="">
          </li>
        
          <li class="item">
            
              <span>支付宝扫一扫</span>
            
            <img src="/images/zhifubao.jpg" alt="">
          </li>
        
        </ul>
      </div>
    </div>
  </div>


   
  <div class="box-prev-next clearfix">
    <a class="show pull-left" href="/2017/10/22/unit-test-mocha-chai/">
        <i class="icon icon-angle-left"></i>
    </a>
    <a class="show pull-right" href="/2017/10/23/js-mock/">
        <i class="icon icon-angle-right"></i>
    </a>
  </div>




</div>


  <a id="backTop" class="back-top">
    <i class="icon-angle-up"></i>
  </a>




  <div class="modal" id="modal">
  <span id="cover" class="cover hide"></span>
  <div id="modal-dialog" class="modal-dialog hide-dialog">
    <div class="modal-header">
      <span id="close" class="btn-close">关闭</span>
    </div>
    <hr>
    <div class="modal-body">
      <ul class="list-toolbox">
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/archives/"
              rel="noopener noreferrer"
              target="_self"
              >
              博客
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/categories/"
              rel="noopener noreferrer"
              target="_self"
              >
              分类
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/tags/"
              rel="noopener noreferrer"
              target="_self"
              >
              标签
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/search/"
              rel="noopener noreferrer"
              target="_self"
              >
              搜索
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/link/"
              rel="noopener noreferrer"
              target="_self"
              >
              友链
            </a>
          </li>
        
          <li class="item-toolbox">
            <a
              class="CIRCLE"
              href="/about/"
              rel="noopener noreferrer"
              target="_self"
              >
              关于
            </a>
          </li>
        
      </ul>

    </div>
  </div>
</div>



  
      <div class="fexo-comments comments-post">
    

    

    
    

    

    
    

    

<!-- Gitalk评论插件通用代码 -->
<div id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script>
const gitalk = new Gitalk({
  clientID: '5567a2c4abb858009d96',
  clientSecret: 'b9039ec056cf5c2346b3cdb63308a28c163f91e5',
  repo: 'poetries.github.io',
  owner: 'poetries',
  // 在这里设置一下截取前50个字符串, 这是因为 github 对 label 的长度有了要求, 如果超过
  // 50个字符串则会报错.
  // id: location.pathname.split('/').pop().substring(0, 49),
  id: location.pathname,
  admin: ['poetries'],
  // facebook-like distraction free mode
  distractionFreeMode: false
})
gitalk.render('gitalk-container')
</script>
<!-- Gitalk代码结束 -->



  </div>

  

  <script type="text/javascript">
  function loadScript(url, callback) {
    var script = document.createElement('script')
    script.type = 'text/javascript';

    if (script.readyState) { //IE
      script.onreadystatechange = function() {
        if (script.readyState == 'loaded' ||
          script.readyState == 'complete') {
          script.onreadystatechange = null;
          callback();
        }
      };
    } else { //Others
      script.onload = function() {
        callback();
      };
    }

    script.src = url;
    document.getElementsByTagName('head')[0].appendChild(script);
  }

  window.onload = function() {
    loadScript('/js/bundle.js?235683', function() {
      // load success
    });
  }
</script>


  <!-- 页面点击小红心 -->
  <script type="text/javascript" src="/js/clicklove.js"></script>
 
  
</body>
</html>
